home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
holdit10.zip
/
HOLDIT.DOC
< prev
next >
Wrap
Text File
|
1993-05-05
|
3KB
|
67 lines
HoldIt.exe -- The program basically does the same as the DOS command
PAUSE. The first difference is that a timeout value can be given as
a parameter specifying the number of seconds the program will wait
for somebody to hit a key before continuing. (0 or no parameter at
all makes the program wait indefinitely) But what would that be good
for without the second difference: the returned errorlevels. If no
user interaction is registered during the specified time, the
program ends returning the errorlevel 0. If any key is pressed the
program exits immediately and returns an errorlevel that depends on
the key that has been hit. In the current version the following
codes will be returned:
Key: 1 2 3 4 5 6 7 8 9 0 ESC any other key
Code: 1 2 3 4 5 6 7 8 9 10 200 100
The program was written in Turbo Pascal 6.0 with a tiny bit of
assembler in it, as can easily be seen in the accompanying source
code. The timeout delay is realized with the internal clock of the
PC: that way 5 seconds are 5 seconds - no matter how 'slow' the
machine is running. Since the date has not been incorporated into
this check the timed delay might be shorter than specified if the
time changes from 23:59 to 00:00 during the 'pause'.
This program was uploaded by the author; I DO NOT claim any rights
whatsoever and encourage everybody to adapt the code to his/her
personal needs. No payments are asked for, you may use it for as
long as you please and do with it whatever you like. I would however
be glad if anyone testing, using and/or modifying this program would
send me a short notice -- just because I'd like to have an idea of
how far it is getting around.
I cannot give a guarantee that the program will perform in the above
outlined manner on a given system, but it has been tested under
MSDOS 5.0 on 286/386/486 cpus. If an error should occur a recompila-
tion of the provided source code should do the trick.
Some points of interest:
- Don't forget that in a batchfile you always have to check for the
highest errorlevel first: "If errorlevel = 1" returns true even if
the level actually is >= 2.
- The message 'Press any key to continue' is written to standard
output (normally the screen). This way it can be redirected to NUL
if you'd rather have some other message displayed instead.
(e.g. echo Press ESC to abort
holdit 5 > NUL
if errorlevel = 200 goto end
)
- If you need other (or more) errorlevels, you can add the desired
keys and levels to the CASE statement at the end of the program
and recompile it afterwards. Or you can get in touch with me
(preferrably via e-mail).
- I'm open to suggestions. Feel free to contact me if you have any
questions or ideas for improvements.
Peter Strickler
HWS, University of Zuerich
Zuerich / Switzerland
K267514@CZHRZU1A.BITNET